package io.yunho.yunho.interview.one.passvalue;

import java.util.Arrays;

/**
 * @author: Jason
 * @date: 2021/3/9 13:56
 * @description:
 */
public class Exam {
    public static void main(String[] args) {
        int i=1; //栈中
        String str = "hello"; //字符对象 常量池中
        Integer num = 2; //包装对象 在堆中
        int[] arr = {1,2,3,4,5}; //数组对象 在堆中
        MyData my = new MyData(); // 在堆中
        change(i,str,num,arr,my);

        System.out.println("i="+i);
        System.out.println("str="+str);
        System.out.println("num="+num);
        System.out.println("arr="+ Arrays.toString(arr));
        System.out.println("my.a="+my.a);
    }

    private static void change(int i, String str, Integer num, int[] arr, MyData my) {
        i +=1;
        str+="world";
        num +=1;
        arr[0] +=1;
        my.a +=1;
    }

}
class MyData {
    int a = 10;
}